class Pulsar extends com.Node {
	private sync: Sync = null;
	private _rotDelta: number = 0;
	private _color: number = 0;
	private _size: number = 0;

	public constructor(baseRadius: number, baseAngle: number, color: number, size: number = 4, rotDelta: number = 0) {
		super(baseRadius, baseAngle);
		this._size = (size);
		this._color = (color);
		this._rotDelta = ((rotDelta * Math.PI) / 180);
		this.sync = new Sync(0.3);
	}

	public setSize(size: number) {
		this._size = (size);
	}

	public setBaseRadius(radius: number) {
		super.setBaseRadius(radius);
	}

	private draw() {
		var angle: number = 0;
		angle = (this._baseAngle + (Math.sin(this.sync.phase) * this._rotDelta));
		this.x = (Math.cos(angle) * this._baseRadius);
		this.y = (Math.sin(angle) * this._baseRadius);
		this.rotation = ((angle * 180) / Math.PI);
		var r: number = (((Math.sin(this.sync.phase) * this._size) / 2) + this._size);	
		var g: egret.Graphics = this.graphics;
		g.clear();
		g.lineStyle(1, GUI.OUTLINE_COLOR);
		g.beginFill(this._color);
		g.drawCircle(0, 0, r);
		g.endFill();
		this.setNodeChildrenRadius(r);
	}

	protected onEnterFrame(event: egret.Event) {
		this.sync.tick();
		this.draw();
	}

	public destruct() {
		super.destruct();
	}

}

